package cn.edu.cdu.group4nb.controller;

import cn.edu.cdu.group4nb.service.EmployerService;
import cn.edu.cdu.group4nb.service.UploadService;
import cn.edu.cdu.group4nb.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class UploadController {
    @Autowired
  private UploadService uploadService;

    @ResponseBody
    @RequestMapping(value = "/employerManager/upload", method = { RequestMethod.POST})
    public R ajaxUploadExcel(HttpServletRequest request, HttpServletResponse response) throws Exception {
        try {
            uploadService.ajaxUploadExcel(request, response);
        }catch (Exception e){
            return R.ok("上传失败") ;
        }

        return R.ok("上传成功") ;

    }
}
